package com.server.llh.llhserverwork.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.llh.llhsuppliers.R;
import com.server.llh.llhserverwork.bean.ProCateService;

import java.util.List;


public class ServerMenuAdapter  extends BaseAdapter{
	private ProCateService infoData;
	List<ProCateService> listData;
	public List<ProCateService> getListData() {
		return listData;
	}
	public void setListData(List<ProCateService> listData) {
		this.listData = listData;
	}

	private Context context;
	public ServerMenuAdapter(Context context,List<ProCateService> listData) {
		this.context=context;
		this.listData=listData;
	}
	@Override
	public int getCount() {
		if (listData == null || listData.size() == 0) {
			return 0;
		}
		return listData.size();
	}

	@Override
	public Object getItem(int position) {
		return listData.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if (convertView == null) {
			convertView = LayoutInflater.from(context).inflate(
					R.layout.server_menu_lv, parent, false);
			holder = new ViewHolder();
			holder.list_item_btn1 = (TextView) convertView
					.findViewById(R.id.list_item_btn1);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		infoData = listData.get(position);
		holder.list_item_btn1.setText(infoData.getCateName());
		return convertView;
	}
	class ViewHolder{
		TextView list_item_btn1;
	}

}
